<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>插槽 slot</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="root">
        <body-content>
            <div class="header"   slot="header">header</div>
            <div class="footer" slot="footer">footer</div>
        </body-content>
    </div>
    <script>
        Vue.component("body-content", {
            template: `<div>
                            <slot name="header"></slot>
                            <div class="content">content</div>
                            <slot name="footer"></slot>
                       </div>`
        })
        var vm = new Vue({
            el: "#root"
        })
    </script>
</body>
</html>